<?php if ($this->Session->read('Auth.User')) {?>
	<div class="homepage-statistic view">
		<h2><?php echo __('SEOpress');?></h2>
	
			<fieldset class="statistic">
			<legend><?php echo __('Servers: ').count($domains['servers']); ?></legend>
				<table>
					<tr>
						<th><?php echo __('Server') ?></th>
						<th><?php echo __('Ip\'s')?></th>
						<th><?php echo __('Domeins')?></th>						
					</tr>
				<?php foreach ($domains['servers'] as $server => $inst_domains) {?>
					<tr>
						<td><?php echo $server ?></td>
						<td><?php echo count($inst_domains['ips'])?></td>
						<td><?php echo count($inst_domains['domains'])?></td>						
					</tr>						
				<?php }?>
				</table>
			</fieldset>	
			
			<fieldset class="statistic">
			<legend><?php echo __('Domains: ').$domains['total-domains']; ?></legend>
				<table>
					<tr>
						<th><?php echo __('domain')?></th>
						<th title="<?php echo __('no keywords')?>"><?php echo __('k')?></th>
						<th title="<?php echo __('no description')?>"><?php echo __('d'); ?></th>
						<th title="<?php echo __('no title')?>"><?php echo __('t')?></th>						
					</tr>
					<?php foreach ($domains['domains'] as $domain_id => $domain) {?>
	
						
					<tr  onclick="document.location='<?php echo $this->Html->url(array('controller'=>'domains','action'=>'view',$domain_id,'d'=>'menus'),true);?>'">
						<td>
							<?php echo $this->Html->link($domain['no_keywords']['name'],array('controller'=>'domains','action'=>'view',$domain_id,'d'=>'menus'))?>
						</td>
						<td>
							<?php echo (!$domain['no_keywords']['ok']) ? 'X' : ''?>
						</td>
						<td>
							<?php echo (!$domain['no_description']['ok']) ? 'X' : ''?>
						</td>
						<td>
							<?php echo (!$domain['no_title']['ok']) ? 'X' : ''?>
						</td>						
					</tr>						
					<?php }?>
				</table>
			</fieldset>	
		
			
	</div>
	<div class="actions">	
		<?php echo $this->element('/menu/main')?>
		<?php echo $this->element('/menu/settings')?>
	</div>
	
<?php
}else{
	echo $this->element('users/login');
}
?>

<script type="text/javascript">
function display_no_keywords(){
	document.getElementById('domains-no-keywords').classList.add('display-statistic');
	document.getElementById('domains-no-keywords').classList.remove('hidden-statistic');

	hidden_no_description();
	hidden_no_title();
}
function hidden_no_keywords(){
	document.getElementById('domains-no-keywords').classList.remove('display-statistic');
	document.getElementById('domains-no-keywords').classList.add('hidden-statistic');
}
// no description
function display_no_description(){
	document.getElementById('domains-no-description').classList.add('display-statistic');
	document.getElementById('domains-no-description').classList.remove('hidden-statistic');
	hidden_no_keywords();
	hidden_no_title();
}
function hidden_no_description(){
	document.getElementById('domains-no-description').classList.remove('display-statistic');
	document.getElementById('domains-no-description').classList.add('hidden-statistic');
}
//no title
function display_no_title(){
	document.getElementById('domains-no-title').classList.add('display-statistic');
	document.getElementById('domains-no-title').classList.remove('hidden-statistic');
	hidden_no_keywords();
	hidden_no_description();
}
function hidden_no_title(){
	document.getElementById('domains-no-title').classList.remove('display-statistic');
	document.getElementById('domains-no-title').classList.add('hidden-statistic');
}
</script>